package org.dna.uimodel;

import org.apache.wicket.model.LoadableDetachableModel;
import org.dna.MetroApplication;
import org.tigris.scarab.model.Activity;

/**
 * Implementation of a LoadableDetachableModel for the Activity entity.
 * */
public class LoadableActivityModel extends LoadableDetachableModel<Activity> {

    private static final long serialVersionUID = -6085236014341544883L;
    private long m_id;

    public LoadableActivityModel(Activity act) {
        super(act);
        m_id = act.getActivityId();
    }

    @Override
    protected Activity load() {
        Activity act = MetroApplication.get().getActivityDAO().queryActivityByID(m_id);
        return new SelectableActivity(act);
    }
}
